﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VCommons
{
    public partial class EmailHelper
    {
        /// <summary>
        /// 发送邮件
        /// </summary>
        /// <param name="mailServerName">发送邮件的SMTP服务器</param>
        /// <param name="mailFrom">发件人邮箱</param>
        /// <param name="mailTo">收件人邮箱</param>
        /// <param name="subject">邮件主题</param>
        /// <param name="body">邮件正文</param>
        /// <param name="userName">访问SMTP服务器的用户名</param>
        /// <param name="password">访问SMTP服务器的密码</param>
        public void Send(
            string mailServerName,
            string mailFrom,
            IList<string> mailTos,
            string subject,
            string body,
            string userName,
            string password)
        {
            Send(mailServerName, mailFrom, mailTos, subject, body, userName, password, null);
        }

        /// <summary>
        /// 发送邮件
        /// </summary>
        /// <param name="mailServerName">发送邮件的SMTP服务器</param>
        /// <param name="mailFrom">发件人邮箱</param>
        /// <param name="mailTo">收件人邮箱</param>
        /// <param name="subject">邮件主题</param>
        /// <param name="body">邮件正文</param>
        /// <param name="userName">访问SMTP服务器的用户名</param>
        /// <param name="password">访问SMTP服务器的密码</param>
        public void Send(
            string mailServerName,
            string mailFrom,
            string mailTos,
            string subject,
            string body,
            string userName,
            string password)
        {
            Send(mailServerName, mailFrom, new string[] { mailTos }, subject, body, userName, password, null);
        }

        /// <summary>
        /// 发送邮件
        /// </summary>
        /// <param name="mailServerName">发送邮件的SMTP服务器</param>
        /// <param name="mailFrom">发件人邮箱</param>
        /// <param name="mailTo">收件人邮箱</param>
        /// <param name="subject">邮件主题</param>
        /// <param name="body">邮件正文</param>
        /// <param name="userName">访问SMTP服务器的用户名</param>
        /// <param name="password">访问SMTP服务器的密码</param>
        /// <param name="cc">获取包含此电子邮件的抄送 (CC) 收件人的地址 可按照索引单独访问的一组对象</param>
        public void Send(
            string mailServerName,
            string mailFrom,
            string mailTos,
            string subject,
            string body,
            string userName,
            string password,
            IList<string> cc)
        {
            Send(mailServerName, mailFrom, new string[] { mailTos }, subject, body, userName, password, cc);
        }


    }
}
